package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.appointmentrecord.AppointmentRecordBO;
import com.micro.modual.model.dto.appointmentrecord.AppointmentRecordDetailDTO;
import com.micro.modual.model.dto.appointmentrecord.AppointmentRecordListDTO;
import com.micro.modual.service.AppointmentRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>预约记录表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:47
 */
@Api(value = "预约管理",tags = "预约管理")
@RestController
@RequestMapping(value = "appointmentRecord")
public class AppointmentRecordController {

    @Autowired
    private AppointmentRecordService appointmentRecordService;

    /**
     * <h2>查找预约记录表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<AppointmentRecordListDTO> {@link AppointmentRecordListDTO}s  预约记录表 列表返回对象
     */
    @ApiOperation(value = "查询预约记录表列表" ,notes = "查询预约记录表列表")
    @GetMapping(value = "/findAppointmentRecordList")
    public RespJsonPageData<AppointmentRecordListDTO> findAppointmentRecordList(@RequestParam  Map<String,Object> params){
        return appointmentRecordService.findList(params,AppointmentRecordListDTO.class);
    }

    /**
     * <h2>根据主键编号查看预约记录表详情</h2>
     * @param id  预约记录表 主键编号
     * @return {@link AppointmentRecordDetailDTO}  预约记录表 详情
     */
    @ApiOperation(value = "查询预约记录表详情",notes = "根据主键编号，查询预约记录表详情")
    @GetMapping(value = "/findAppointmentRecordDetail/{id}")
    public RespJsonData<AppointmentRecordDetailDTO> findAppointmentRecordDetail(@PathVariable("id") Long id){
        return appointmentRecordService.findDetail(id,AppointmentRecordDetailDTO.class);
    }

    /**
     * <h2>新增预约记录表详情</h2>
     * @param appointmentRecordBO {@link AppointmentRecordBO} 预约记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "新增预约记录表",notes = "新增预约记录表")
    @PostMapping(value = "/addAppointmentRecord")
    public RespJson addAppointmentRecord(@RequestBody AppointmentRecordBO appointmentRecordBO){
        return appointmentRecordService.addAppointmentRecord(appointmentRecordBO);
    }

    /**
     * <h2>修改预约记录表详情</h2>
     * @param appointmentRecordBO  {@link AppointmentRecordBO} 预约记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "修改预约记录表",notes = "修改预约记录表")
    @PostMapping(value = "/editAppointmentRecord")
    public RespJson editAppointmentRecord(@RequestBody AppointmentRecordBO appointmentRecordBO){
        return appointmentRecordService.editAppointmentRecord(appointmentRecordBO);
    }

    /**
     * <h2>根据主键编号删除预约记录表信息</h2>
     * @param id  预约记录表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除预约记录表",notes = "根据地址ID，删除预约记录表")
    @PostMapping(value = "/deleteAppointmentRecord/{id}")
    public RespJson deleteAppointmentRecord(@PathVariable("id") Long id){
        return appointmentRecordService.deleteAppointmentRecord(id);
    }
}

